package com.yitiao.data_algorithms.leetcode.editor.cn;

import com.yitiao.data_algorithms.leetcode.editor.cn.base.ListNode;
import com.yitiao.data_algorithms.leetcode.editor.cn.base.TreeNode;

class ReverseString {
    // 2022-08-23 10:46:36
    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public void reverseString(char[] s) {
            int head = 0, tail = s.length - 1;
            while (head < tail) {
                // 交换
                char c = s[head];
                s[head] = s[tail];
                s[tail] = c;
                head++;  // 头指针前移
                tail--;  // 尾指针后移
            }
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}